/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.java.editor;

import com.java.mapbean.Tacgia;
import com.java.service.TacGiaService;
import java.beans.PropertyEditorSupport;

/**
 *
 * @author quannq
 */
public class TacGiaEditor extends PropertyEditorSupport {

    public TacGiaService tacGiaService;

    public TacGiaEditor(TacGiaService tacGiaService) {
        super();
        this.tacGiaService = tacGiaService;
    }

    @Override
    public void setAsText(String text) throws IllegalArgumentException {
        if (!text.equals("")) {
            Tacgia emp = tacGiaService.findId(Integer.parseInt(text));
            setValue(emp);
        } else {
            setValue(null);
        }
    }
}
